import type { UserConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import UnoCSS from 'unocss/vite'
import autoImport from 'unplugin-auto-import/vite'
import { defineConfig } from 'vite'
import './vite.init'

export default defineConfig(async ({ mode }) => {
  return {
    base: '/',
    plugins: [
      vue(),
      vueJsx(),
      UnoCSS(),
      autoImport({
        imports: ['vue'],
        dts: 'typings/auto-imports.d.ts', // 生成 `auto-import.d.ts` 全局声明
      }),
    ],
    server: {
      port: 5174,
      host: true,
    },
  } as UserConfig
})
